﻿<Window x:Class="HAP.UserCard.MainWindow" 
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
        xmlns:tbi="http://www.hardcodet.net/taskbar" 
        xmlns:u="clr-namespace:HAP.UserCard" 
        u:WindowBehavior.HideCloseButton="True"
        Title="My User Card" Height="350" Width="393" Topmost="True" 
        ShowInTaskbar="False" ResizeMode="NoResize" Background="White" 
        Deactivated="Window_Deactivated" Loaded="Window_Loaded" Closing="Window_Closing">
    <Window.Resources>
        <u:imageconverter x:Key="ic" />
        <Storyboard x:Key="hidemess">
            <DoubleAnimation Storyboard.TargetName="infomess" Storyboard.TargetProperty="Opacity" From="0" To="1.0" Duration="0:0:0.5" BeginTime="0:0:0" />
            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="infomess" Storyboard.TargetProperty="Visibility">
                <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{x:Static Visibility.Visible}" />
            </ObjectAnimationUsingKeyFrames>
            <DoubleAnimation Storyboard.TargetName="infomess" Storyboard.TargetProperty="Opacity" From="1.0" To="0.0" Duration="0:0:2" BeginTime="0:0:2" />
            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="infomess" Storyboard.TargetProperty="Visibility">
                <DiscreteObjectKeyFrame KeyTime="0:0:4" Value="{x:Static Visibility.Hidden}" />
            </ObjectAnimationUsingKeyFrames>
        </Storyboard>
        <Style TargetType="{x:Type TabItem}">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type TabItem}">
                        <Grid>
                            <Border Name="Border" BorderBrush="#FFB6BABF" Background="WhiteSmoke" BorderThickness="1" CornerRadius="3,3,0,0">
                                <Grid>
                                    <Grid.Background>
                                        <RadialGradientBrush>
                                            <GradientStop Color="#CCFFFFFF" Offset="0.2" />
                                            <GradientStop Color="#00FFFFFF" Offset="0.90" />
                                        </RadialGradientBrush>
                                    </Grid.Background>
                                    <TextBlock FontSize="13">
                                        <ContentPresenter VerticalAlignment="Center" HorizontalAlignment="Center" ContentSource="Header" Margin="14,3,14,3" />
                                    </TextBlock>
                                </Grid>
                            </Border>
                        </Grid>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsSelected" Value="True">
                                <Setter TargetName="Border" Property="Background" Value="White" />
                                <Setter TargetName="Border" Property="BorderThickness" Value="1,1,1,0" />
                                <Setter TargetName="Border" Property="Margin" Value="0" />
                            </Trigger>
                            <MultiTrigger>
                                <MultiTrigger.Conditions>
                                    <Condition Property="IsMouseOver" Value="False" />
                                    <Condition Property="IsSelected" Value="False" />
                                </MultiTrigger.Conditions>
                                <MultiTrigger.Setters>
                                    <Setter TargetName="Border" Property="Background" Value="Transparent" />
                                    <Setter TargetName="Border" Property="BorderThickness" Value="0" />
                                    <Setter TargetName="Border" Property="Margin" Value="1,1,1,0" />
                                </MultiTrigger.Setters>
                            </MultiTrigger>
                            <MultiTrigger>
                                <MultiTrigger.Conditions>
                                    <Condition Property="IsMouseOver" Value="True" />
                                    <Condition Property="IsSelected" Value="False" />
                                </MultiTrigger.Conditions>
                                <MultiTrigger.Setters>
                                    <Setter TargetName="Border" Property="Background" Value="#77FFFFFF" />
                                    <Setter TargetName="Border" Property="BorderThickness" Value="1,1,1,0" />
                                    <Setter TargetName="Border" Property="Margin" Value="0" />
                                </MultiTrigger.Setters>
                            </MultiTrigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        <Style  TargetType="{x:Type TabControl}">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type TabControl}">
                        <Grid>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="*"/>
                            </Grid.RowDefinitions>
                            <TabPanel Grid.Row="0" Panel.ZIndex="1" IsItemsHost="True" Background="Transparent" />
                            <Border Grid.Row="1" BorderThickness="0,1,0,0" Background="White" BorderBrush="#FFB6BABF"  Margin="0,-1,0,0">
                                <ContentPresenter ContentSource="SelectedContent" />
                            </Border>
                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        <DataTemplate x:Key="departmentlistitem">
            <TextBlock Text="{Binding Path=Name}" />
        </DataTemplate>
    </Window.Resources>
    <Grid>
        <TabControl Name="tabs" SelectionChanged="tabs_SelectionChanged">
            <TabItem Header="Me" Name="me">
                <Grid>
                    <Image Height="148" HorizontalAlignment="Left" Margin="4,3,0,0" Name="Photo" Stretch="None" VerticalAlignment="Top" Width="148" Source="/HAP%20User%20Card;component/Images/Imageres18.png" />
                    <TextBlock Text="UN" Name="name" Margin="156,44,7,0" VerticalAlignment="Top" FontSize="16" TextAlignment="Left" TextTrimming="CharacterEllipsis" />
                    <TextBlock Text="UN" Margin="157,78,0,0" Name="departmenttext" HorizontalAlignment="Left" Height="16" VerticalAlignment="Top" />
                    <TextBox Name="email" VerticalAlignment="Top" Margin="154,101,6,0" Height="22" IsReadOnly="True" BorderThickness="0" />
                    <Grid Name="DriveSpace" Height="131" VerticalAlignment="Bottom"  Visibility="Hidden">
                        <TextBlock HorizontalAlignment="Left" Margin="26,13,0,0" Text="Home Drive: " VerticalAlignment="Top" />
                        <TextBox VerticalAlignment="Top" Text="N:" BorderThickness="0" Margin="101,12,20,0" Name="homedrive" IsReadOnly="True" />
                        <TextBlock HorizontalAlignment="Left" Margin="26,45,20,0" Text="Free Space: " VerticalAlignment="Top" Name="freespace" />
                        <TextBlock Margin="160,45,0,0" Text="Total Space: " HorizontalAlignment="Left" VerticalAlignment="Top" Name="totalspace" />
                        <ProgressBar Height="22" HorizontalAlignment="Stretch" Margin="20,75,20,0" Name="drivespaceprog" VerticalAlignment="Top" />
                        <TextBlock Margin="0,78,0,0" Text="%" HorizontalAlignment="Stretch" VerticalAlignment="Top" TextAlignment="Center" Name="drivespaceper" />
                    </Grid>
                </Grid>
            </TabItem>
            <TabItem Header="Reset Passwords" Name="pass">
                <Grid HorizontalAlignment="Center" VerticalAlignment="Center">
                    <TextBlock Text="Username: " Margin="0,3,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" />
                    <TextBox Height="23" HorizontalAlignment="Left" Margin="68,0,0,0" Name="username" VerticalAlignment="Top" Width="146" KeyUp="username_KeyUp" />
                    <Button Content="Reset" Height="26" Width="118" Name="reset" Margin="0,30,0,0" VerticalAlignment="Top" HorizontalAlignment="Right" IsEnabled="False" Click="reset_Click" />
                </Grid>
            </TabItem>
            <TabItem Header="Controlled Users" Name="controlled">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="*" />
                        <RowDefinition Height="40" />
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="*" />
                        <ColumnDefinition Width="*" />
                    </Grid.ColumnDefinitions>
                    <TreeView Name="treeView1" Grid.Row="0" Padding="10" BorderThickness="0" SelectedItemChanged="treeView1_SelectedItemChanged" Grid.ColumnSpan="2" />
                    <Button Name="enable" Content="Enable" Height="25" Margin="6,6,3,6" Click="enable_Click" IsEnabled="False" Grid.Row="1" />
                    <Button Name="disable" Content="Disable" Height="25" Margin="3,6,6,6" Click="disable_Click" IsEnabled="False" Grid.Row="1" Grid.Column="1" />
                </Grid>
            </TabItem>
            <TabItem Header="Help Desk" Name="helpdesk">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="*" />
                        <RowDefinition Height="Auto" />
                    </Grid.RowDefinitions>
                    <TextBlock Text="My Tickets" Grid.Row="0" Margin="10,10,0,0" Foreground="#FF2F5F93" FontSize="14" />
                    <ListView Name="ticketbox" Margin="6" Visibility="Collapsed" Grid.Row="1" MouseDoubleClick="ticketbox_MouseDoubleClick">
                        <ListView.ContextMenu>
                            <ContextMenu>
                                <MenuItem Header="Refresh" Click="MenuItem_Click" />
                            </ContextMenu>
                        </ListView.ContextMenu>
                        <ListView.View>
                            <GridView>
                                <GridViewColumn Width="34">
                                    <GridViewColumn.CellTemplate>
                                        <DataTemplate>
                                            <TextBlock Text="{Binding Path=Status}" />
                                        </DataTemplate>
                                    </GridViewColumn.CellTemplate>
                                </GridViewColumn>
                                <GridViewColumn Width="34">
                                    <GridViewColumn.CellTemplate>
                                        <DataTemplate>
                                            <Image Source="{Binding Path=Priority, Converter={StaticResource ic}}" />
                                        </DataTemplate>
                                    </GridViewColumn.CellTemplate>
                                </GridViewColumn>
                                <GridViewColumn Header="Subject" Width="220">
                                    <GridViewColumn.CellTemplate>
                                        <DataTemplate>
                                            <TextBlock Text="{Binding Path=Subject}" />
                                        </DataTemplate>
                                    </GridViewColumn.CellTemplate>
                                </GridViewColumn>
                                <GridViewColumn Header="Room" Width="50">
                                    <GridViewColumn.CellTemplate>
                                        <DataTemplate>
                                            <TextBlock Text="{Binding Path=Room}" />
                                        </DataTemplate>
                                    </GridViewColumn.CellTemplate>
                                </GridViewColumn>
                            </GridView>
                        </ListView.View>
                    </ListView>
                    <Button Content="New Ticket" Name="newticket" Width="100" Height="23" Margin="0,0,6,6" VerticalAlignment="Bottom" HorizontalAlignment="Right" Grid.Row="2" Click="newticket_Click" />
                    <TextBlock Grid.Row="1" Name="notickets" Text="No Open Tickets" VerticalAlignment="Center" HorizontalAlignment="Center" />
                </Grid>
            </TabItem>
        </TabControl>
        <Border HorizontalAlignment="Center" Opacity="0" Name="infomess" VerticalAlignment="Center" Padding="5" Background="#FFF1F5FB" BorderBrush="#FF7B7B73" BorderThickness="1" CornerRadius="6" Visibility="Hidden">
            <StackPanel Orientation="Horizontal">
                <Image Height="32" Margin="0,0,0,0" Stretch="None" VerticalAlignment="Center" Width="32" Source="/HAP%20User%20Card;component/Images/261.png" />
                <TextBlock Text="Label" Margin="10,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Stretch" Name="text" TextWrapping="Wrap" />
            </StackPanel>
        </Border>
    </Grid>
</Window>